package day_05;

import java.util.Scanner;

/**
 * @ClassName Day05Homework_8
 * @Description TODO
 * @Author hp
 * @Date 2021/6/7 16:13
 * @Version 1.0
 **/
public class Day05Homework_8 {
    public static void main(String[] args) {
        char[] chars = new char[]{'A','D','B','C','D'};
        char[] chars1 = new char[5];
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入学生姓名:");
        String name = scanner.next();
        System.out.print("请输入学生答案:");
        String answer = scanner.next();
        for (int i = 0; i <chars1.length ; i++) {
            chars1[i]=answer.toUpperCase().charAt(i);
        }
        getScores(chars, chars1,name);
    }

    public static void getScores(char[] chars, char[] chars1,String name) {

        int sum = 0;
        for (int i = 0; i <chars.length ; i++) {
            if (chars[i]==chars1[i]) {
                sum+=2;
            }
        }

        System.out.println("满分10分,"+name+":得分:"+sum+"分");
    }

}
